# -------------------------------------------------
# DEMOENGINE_ROOT/SWIG/CmakeLists.txt 
# -------------------------------------------------

###################################################
PROJECT(demoEnginePython)


###################################################
# SOURCES
SET(PROJECT_SRCS  ${PROJECT_BINARY_DIR}/demoEnginePython.cpp )
SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/demoEnginePython.cpp PROPERTIES GENERATED TRUE )


###################################################
# include
INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} ${OSG_INCLUDE_DIR} "../src" )

###################################################
# libs PATH
LINK_DIRECTORIES( ${LIBRARY_OUTPUT_PATH} )

###################################################
# LIBRAY
ADD_LIBRARY(${PROJECT_NAME} SHARED ${PROJECT_SRCS} )

###################################################
# SWIG need the DLL name to be prefixed with a "_"
SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES PREFIX "_" )

###################################################
# libs to link
SET(PROJECT_LIBS demoEngine.lib ${PYTHON_LIBRARY} )
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PROJECT_LIBS})

###################################################
# DEPENDENCIES
ADD_DEPENDENCIES(${PROJECT_NAME} demoEngine )

###################################################
# SWIG
FIND_PACKAGE(SWIG REQUIRED)

#PRE_BUILD_COMMAND
SET( PRE_BUILD_COMMAND ${SWIG_EXECUTABLE} -c++ -python -v -I${PROJECT_SOURCE_DIR}/../src -o ${PROJECT_BINARY_DIR}/demoEnginePython.cpp ${PROJECT_SOURCE_DIR}/DemoEngine.i )
#MESSAGE("-->${PRE_BUILD_COMMAND}<--") 
ADD_CUSTOM_COMMAND( TARGET ${PROJECT_NAME}     PRE_BUILD     COMMAND ${PRE_BUILD_COMMAND}  )    

###################################################
# INSTALL
INSTALL(  TARGETS ${PROJECT_NAME}                           DESTINATION ${INST_DIR} )
INSTALL(  FILES   ${PROJECT_BINARY_DIR}/demoEnginePython.py DESTINATION ${INST_DIR} )


